Xceed Toolkit Plus for WPF v4.6 Documentation
Providing a cell error style

The following example demonstrates how to provide a new style that will change the foreground color of a cell when its value fails the validation process.

XAML
Copy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
     xmlns:local="clr-namespace:Xceed.Wpf.Documentation">
  <Grid.Resources>
     <xcdg:DataGridCollectionViewSource x:Key="cvs_composers"
                                        Source="{Binding Source={x:Static Application.Current},
                                                         Path=Composers}"/>
     <Style x:Key="cell_error" TargetType="{x:Type xcdg:DataCell}">
          <Setter Property="Foreground" Value="Red"/>
       </Style>
  </Grid.Resources>
  <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource cvs_composers}}"
                                            CellErrorStyle="{StaticResource cell_error}">
     <xcdg:DataGridControl.Columns>
       <xcdg:Column FieldName="Period"
                    CellEditor="{StaticResource periodEditor}">                                  
          <xcdg:Column.CellValidationRules>
             <local:PeriodVSCompositionCountCellValidationRule/>
          </xcdg:Column.CellValidationRules>
       </xcdg:Column>
       <xcdg:Column FieldName="CompositionCount">
          <xcdg:Column.CellValidationRules>
             <local:PeriodVSCompositionCountCellValidationRule />
          </xcdg:Column.CellValidationRules>
       </xcdg:Column>
     </xcdg:DataGridControl.Columns>
  </xcdg:DataGridControl>
</Grid>